#ifndef _CPS_SOCKET_H__
#define _CPS_SOCKET_H__

#include "CPS_type.h"

CPS_SOCKET_T CPS_socket( CPS_SOCKET_FAMILY_E family, CPS_SOCKET_TYPE_E type, CPS_SOCKET_PROTOCOL_E protocol );
CPS_ERROR_CODE_T CPS_closesocket( CPS_SOCKET_T socket );
CPS_ERROR_CODE_T CPS_shutdown( CPS_SOCKET_T socket, CPS_SOCKET_HOW_E hown );
int CPS_bind(
		 CPS_SOCKET_T s,
		 const CPS_sockaddr_in * addr,
		 int addr_len
		 );

int CPS_connect(
			CPS_SOCKET_T s,
			const CPS_sockaddr_in * addr,
			int addr_len
			);

int CPS_send(
		 CPS_SOCKET_T s,
		 const char * buf,
		 int len,
		 int flags
		 );
int CPS_sendto(
		   CPS_SOCKET_T s,
		   const char * buf, 
		   int len,
		   int flags,
		   const CPS_sockaddr_in * to,
		   int tolen
		   );
int CPS_recv(
		 CPS_SOCKET_T s,
		 char * buf,
		 int len,
		 int flags
		 );

int CPS_recvfrom(
			 CPS_SOCKET_T s,
			 char FAR* buf,
			 int len,
			 int flags,
			 CPS_sockaddr_in* from,
			 int * fromlen
	);

CPS_SOCKET_T CPS_accept(
			  CPS_SOCKET_T s,
			  CPS_sockaddr_in* addr,
			  int * addrlen
	);

int CPS_listen(
		   CPS_SOCKET_T s,
		   int backlog
		   );
#endif